<html>
<head><meta charset="utf-8"><title>Is there a way to go from Vec&lt;u8&gt; to PathBuf? · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Is.20there.20a.20way.20to.20go.20from.20Vec.3Cu8.3E.20to.20PathBuf.3F.html">Is there a way to go from Vec&lt;u8&gt; to PathBuf?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="212897480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Is%20there%20a%20way%20to%20go%20from%20Vec%3Cu8%3E%20to%20PathBuf%3F/near/212897480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Is.20there.20a.20way.20to.20go.20from.20Vec.3Cu8.3E.20to.20PathBuf.3F.html#212897480">(Oct 10 2020 at 03:53)</a>:</h4>
<p>There's String::from_utf8, but I don't want a utf8 validation check - I don't need valid utf8.</p>



<a name="212897612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Is%20there%20a%20way%20to%20go%20from%20Vec%3Cu8%3E%20to%20PathBuf%3F/near/212897612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Chris Denton <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Is.20there.20a.20way.20to.20go.20from.20Vec.3Cu8.3E.20to.20PathBuf.3F.html#212897612">(Oct 10 2020 at 03:57)</a>:</h4>
<p>Unix has <a href="https://doc.rust-lang.org/std/os/unix/ffi/trait.OsStringExt.html#tymethod.from_vec"><code>from_vec</code></a> for <code>OsString</code>.</p>



<a name="212897617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Is%20there%20a%20way%20to%20go%20from%20Vec%3Cu8%3E%20to%20PathBuf%3F/near/212897617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Is.20there.20a.20way.20to.20go.20from.20Vec.3Cu8.3E.20to.20PathBuf.3F.html#212897617">(Oct 10 2020 at 03:57)</a>:</h4>
<p>oh I see, on windows things aren't Vec</p>



<a name="212897791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Is%20there%20a%20way%20to%20go%20from%20Vec%3Cu8%3E%20to%20PathBuf%3F/near/212897791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Chris Denton <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Is.20there.20a.20way.20to.20go.20from.20Vec.3Cu8.3E.20to.20PathBuf.3F.html#212897791">(Oct 10 2020 at 04:02)</a>:</h4>
<p>On Windows Rust uses its own special encoding called "WTF-8". But it's also really insistent that programs aren't allowed to see WTF-8... so the API ends up being weirder than it would otherwise be.</p>



<a name="212909260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Is%20there%20a%20way%20to%20go%20from%20Vec%3Cu8%3E%20to%20PathBuf%3F/near/212909260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Is.20there.20a.20way.20to.20go.20from.20Vec.3Cu8.3E.20to.20PathBuf.3F.html#212909260">(Oct 10 2020 at 10:19)</a>:</h4>
<p><a href="https://github.com/dylni/os_str_bytes">https://github.com/dylni/os_str_bytes</a></p>



<a name="212917090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Is%20there%20a%20way%20to%20go%20from%20Vec%3Cu8%3E%20to%20PathBuf%3F/near/212917090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Is.20there.20a.20way.20to.20go.20from.20Vec.3Cu8.3E.20to.20PathBuf.3F.html#212917090">(Oct 10 2020 at 13:50)</a>:</h4>
<p>nice, thanks :) unfortunately this is in bootstrap so allowing non-utf8 is probably not worth the new dependency, but I'll keep it in mind</p>



<a name="212971659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Is%20there%20a%20way%20to%20go%20from%20Vec%3Cu8%3E%20to%20PathBuf%3F/near/212971659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Is.20there.20a.20way.20to.20go.20from.20Vec.3Cu8.3E.20to.20PathBuf.3F.html#212971659">(Oct 11 2020 at 16:26)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> There are the OsStrExt traits.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>